<layout name="page" />
<block name="content">
	{:widget('page_header/simple',array('name'=>'考勤规则管理','search'=>'M'))}
	<div class="operate-panel">
		<a class="btn btn-del" id="btn_del">删除</a>
		<a class="btn btn-primary hidden" onclick="go_out()">外出规则</a>
		<div class="split"></div>
		<a class="btn" onclick="add()">新增规则</a>
	</div>
	<div class="frame">
		<form id="form_data" name="form_data" method='post'>
			<div class="ul-table">
				<ul>
					<li class="thead">
						<span class="col-3 checkbox">
							<input  type="checkbox"class="toggle-select-all" data="contact_id[]"/>
						</span>
						<span class="col-15">规则名称</span>
						<span class="col-12">签到/签退时间</span>
						<span class="col-6">状态</span>
						<span class="col-16  x1">考勤地点</span>
					</li>
					<foreach name="list" val="vo">
						<li class="tbody">
							<span class="col-3 checkbox">
								<input type="checkbox" name="contact_id[]" value="{$vo.id}" />
							</span>
							<span class="col-15"><a href="{:url('SignRule/edit')}&id={$vo.id}">{$vo.name}&nbsp;&nbsp;</a></span>
							<span class="col-12">{$vo.start_time}/{$vo.end_time}&nbsp;&nbsp;</span>
							<eq name="vo.is_del" value="0">
								<span class="col-6">启用&nbsp;&nbsp;</span>
								<else/>
								<span class="col-6">禁用&nbsp;&nbsp;</span>
							</eq>
							<span class="col-16  x1">{$vo.address}&nbsp;&nbsp;</span>
						</li>
					</foreach>
				</ul>
			</div>
		</form>
	</div>
	<div class="pagination">
		{$page}
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;

			$("#btn_del").on('click', function() {
				if ($("input[name='contact_id[]']:checked").length == 0) {
					layer.msg('请选择要删除的项目');
					return false;
				}
				//信息框-例2
				layer.msg('确定要删除吗?', {
					time : 0,
					btn : ['确定', '取消'],
					yes : function(index) {
						var vars = $("#form_data").serialize();
						send_ajax("{:url('del')}", vars, function(ret) {
							if (ret.status) {
								layer.msg(ret.info, function() {
									location.reload(true);
								});
							}
						});
					},
					no : function(index) {
						layer.close(index);
					}
				});
			});

			$("#btn_add").on('click', function() {
				window.open("{:url('add')}", '_self');
			});

			set_return_url(null);
		});
	</script>
</block>
